package cn.yll.common.module;

import com.alibaba.fastjson2.JSON;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * 分页对象响应实体
 * @author yangll
 * @param <T>
 */
@Data
@AllArgsConstructor
@Accessors(chain = true)
@ApiModel("分页数据请求响应实体")
public class PageModel<T> implements Serializable {

    @ApiModelProperty("数据总行数")
    private int total;

    @ApiModelProperty("本页数据列表")
    private List<T> data;

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    public PageModel(){
        this.total = 0;
    }

}
